package com.vrv.common.listview;

import java.util.ArrayList;
import java.util.HashMap;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
/**
 * @Description ListView适配器类
 * 
 * @author gaopei
 * @date 
 */
public class ListViewAdapter extends BaseAdapter {

		ArrayList<HashMap<String, Object>> curListData = new ArrayList<HashMap<String, Object>>();

		@Override
		public int getCount() {
			return curListData.size();
		}
		
		public HashMap<String, Object> getData(int position) {
			return (HashMap<String, Object>)curListData.get(position);
		}

		@Override
		public Object getItem(int position) {
			return curListData.get(position);
		}

		@Override
		public long getItemId(int position) {
			return position;
		}

		@Override
		public View getView(int position, View view, ViewGroup parent) {
			
			return view;
		}

		public void addItem(final HashMap<String, Object> item) {
			curListData.add(item);
		}

		public void delItem(final HashMap<String, Object> item) {
			curListData.remove(item);
		}
		
		public void clear(){
			curListData.clear();
		}
	}